public class PerformanceMonitorDecorator extends MachineDecorator {
    public PerformanceMonitorDecorator(OldMachineInterface machine) {
        super(machine);
    }

    @Override
    public double getSensorData() {
        long startTime = System.currentTimeMillis();
        double result = super.getSensorData();
        long endTime = System.currentTimeMillis();
        System.out.println("[性能监控] getSensorData() 方法耗时: " + (endTime - startTime) + "ms");
        return result;
    }

    @Override
    public void startEngine() {
        long startTime = System.currentTimeMillis();
        super.startEngine();
        long endTime = System.currentTimeMillis();
        System.out.println("[性能监控] startEngine() 方法耗时: " + (endTime - startTime) + "ms");
    }

    @Override
    public String getStatus() {
        long startTime = System.currentTimeMillis();
        String result = super.getStatus();
        long endTime = System.currentTimeMillis();
        System.out.println("[性能监控] getStatus() 方法耗时: " + (endTime - startTime) + "ms");
        return result;
    }
}
